﻿@model IEnumerable<PortalBusiness.Models.PENDENCIA>

@{
    ViewBag.Title = "Pendência";
}

<h3>Pendência</h3>

<p>
    @Html.ActionLink("Cadastrar Novo", "Create")
</p>
<table class="table">
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.CODIGO_NEGOCIO)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.CODIGO_LOJA)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.DATA_PROCESSAMENTO)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.HORA_PROCESSAMENTO)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.LOGIN)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.COMPARTILHAMENTO)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.DESCRICAO)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.STATUS)
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.CODIGO_NEGOCIO)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.CODIGO_LOJA)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.DATA_PROCESSAMENTO)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.HORA_PROCESSAMENTO)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.LOGIN)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.COMPARTILHAMENTO)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.DESCRICAO)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.STATUS)
        </td>
        <td>
            @if (item.STATUS != PortalBusiness.Models.PendenciaStatus.Concluido)
            {
                if (item.LOGIN == User.Identity.Name)
                {
                    @Html.ActionLink("Editar", "Edit", new { id = item.PENDENCIAID }) @Html.Label("|")
                }
                @Html.ActionLink("Detalhes", "Details", new { id=item.PENDENCIAID } ) 
                if (item.LOGIN == User.Identity.Name)
                {
                    @Html.Label("|")
                    @Html.ActionLink("Deletar", "Delete", new { id = item.PENDENCIAID })
                }
            }
        </td>
    </tr>
}

</table>
